home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / util / libs / graphics3d.lha / doc / graphics3D.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-17  |  14.2 KB  |  358 lines

  1. @DATABASE "graphics3D.h"
  2. @MASTER   "ram:graphics3D.h"
  3. @REMARK   This file was created by ADtoHT 2.1 on 17-Ott-98 15:31:08
  4. @REMARK   Do not edit
  5. @REMARK   ADtoHT is © 1993-1995 Christian Stieber
  6.  
  7. @NODE MAIN "graphics3D.h"
  8.  
  9. @{"graphics3D.h" LINK File}
  10.  
  11.  
  12. @{b}Structures@{ub}
  13.  
  14. @{"ambient3d" LINK "graphics3D.h/File" 218}   @{"dir3d" LINK "graphics3D.h/File" 142}   @{"grafica" LINK "graphics3D.h/File" 285}  @{"line" LINK "graphics3D.h/File" 135}      @{"matrix1x4" LINK "graphics3D.h/File" 107}  @{"matrix4x4" LINK "graphics3D.h/File" 85}
  15. @{"objectnode" LINK "graphics3D.h/File" 166}  @{"pixel" LINK "graphics3D.h/File" 127}   @{"polygon" LINK "graphics3D.h/File" 150}  @{"polytemp" LINK "graphics3D.h/File" 193}  @{"rgbtype" LINK "graphics3D.h/File" 53}    @{"tag3d" LINK "graphics3D.h/File" 62}
  16. @{"vector" LINK "graphics3D.h/File" 117}      @{"vertex" LINK "graphics3D.h/File" 45}  
  17.  
  18.  
  19. @{b}Typedefs@{ub}
  20.  
  21. @{"Sambient3d" LINK "graphics3D.h/File" 281}  @{"SAreaInfo" LINK "graphics3D.h/File" 271}  @{"Sdir3d" LINK "graphics3D.h/File" 279}     @{"Sgrafica" LINK "graphics3D.h/File" 270}  @{"Smatrix4x4" LINK "graphics3D.h/File" 280}  @{"Sobjectnode" LINK "graphics3D.h/File" 274}
  22. @{"Spolygon" LINK "graphics3D.h/File" 276}    @{"Spolytemp" LINK "graphics3D.h/File" 278}  @{"SRastPort" LINK "graphics3D.h/File" 273}  @{"STmpRas" LINK "graphics3D.h/File" 272}   @{"Svector" LINK "graphics3D.h/File" 277}     @{"Svertex" LINK "graphics3D.h/File" 275}
  23.  
  24.  
  25. @{b}#defines@{ub}
  26.  
  27. @{"ATMP" LINK "graphics3D.h/File" 81}       @{"COMPLEMENT" LINK "graphics3D.h/File" 15}  @{"CS_GCOLOR" LINK "graphics3D.h/File" 37}  @{"CS_NPX0" LINK "graphics3D.h/File" 39}   @{"CS_NPY0" LINK "graphics3D.h/File" 40}  @{"CS_PROJET" LINK "graphics3D.h/File" 35}
  28. @{"CS_SBUFF" LINK "graphics3D.h/File" 36}   @{"CS_VDIST" LINK "graphics3D.h/File" 38}    @{"CS_ZOOM" LINK "graphics3D.h/File" 41}    @{"END_T" LINK "graphics3D.h/File" 29}     @{"FIXV" LINK "graphics3D.h/File" 25}     @{"FIXVM" LINK "graphics3D.h/File" 26}
  29. @{"FLAT" LINK "graphics3D.h/File" 21}       @{"FRUSTUM" LINK "graphics3D.h/File" 23}     @{"INVERSVID" LINK "graphics3D.h/File" 16}  @{"JAM1" LINK "graphics3D.h/File" 13}      @{"JAM2" LINK "graphics3D.h/File" 14}     @{"LTMP" LINK "graphics3D.h/File" 80}
  30. @{"MAXOBJECT" LINK "graphics3D.h/File" 73}  @{"MAXPLFRAM" LINK "graphics3D.h/File" 74}   @{"MAXPOINT" LINK "graphics3D.h/File" 72}   @{"MAXVER()" LINK "graphics3D.h/File" 265}  @{"MAXVERT" LINK "graphics3D.h/File" 75}  @{"MFRAC" LINK "graphics3D.h/File" 27}
  31. @{"MINT" LINK "graphics3D.h/File" 28}       @{"PARAL_P" LINK "graphics3D.h/File" 18}     @{"PROSP_P" LINK "graphics3D.h/File" 17}    @{"SFIXV" LINK "graphics3D.h/File" 24}     @{"SMARG" LINK "graphics3D.h/File" 78}    @{"SMARGM" LINK "graphics3D.h/File" 79}
  32. @{"SOLID" LINK "graphics3D.h/File" 20}      @{"WIREF" LINK "graphics3D.h/File" 19}       @{"ZPLANE" LINK "graphics3D.h/File" 22}     
  33.  
  34. @ENDNODE
  35. @NODE File "graphics3D.h"
  36. /*
  37. **      $VER: graphics3d.h 10.02 (02.03.98)
  38. **
  39. **      main include file for @{"graphics3d.library" LINK "graphics3d_E/MAIN"}
  40. **
  41. **      (C) Copyright 1997 Patrizio Biancalani
  42. **      All Rights Reserved.
  43. */
  44.  
  45. #ifndef GRAPHICS3D_GRAPHICS3D_H
  46. #define GRAPHICS3D_GRAPHICS3D_H
  47.  
  48. #define JAM1 0
  49. #define JAM2 1
  50. #define COMPLEMENT 2
  51. #define INVERSVID 4
  52. #define PROSP_P 0       /* tipo proiezione prospettica */
  53. #define PARAL_P 1       /* tipo proiezione parallela */
  54. #define WIREF   0       /* modo visualizzazione in wire frame */
  55. #define SOLID   2       /* modo visualizzazione in solid */
  56. #define FLAT    1       /* modo visualizzazione i flat shading */
  57. #define ZPLANE  0       /* #1 modo clippaggio oggetti */
  58. #define FRUSTUM 1       /* #2 modo clippaggio oggetti */
  59. #define SFIXV   8       /* n# di shift per cal. num. virgola fissa */
  60. #define FIXV    256     /* fattore moltipl. per num. virgola fissa */
  61. #define FIXVM   128     /* meta' di @{"FIXV" LINK File 25} , per effettuare appros.  */
  62. #define MFRAC   @{"FIXV" LINK File 25}    /* maschera per estrarre parte frazionaria */
  63. #define MINT 0xFFFFFFFF /* maschera per estrarre parte intera */
  64. #define END_T  0        /* fine array tag3d di dati */
  65.  
  66. /*
  67.   tipi dati per tag3d.tipo riconosciuti attualmente per
  68.   funzione cascene()
  69. */
  70. #define CS_PROJET 1     /* tipo di proiezione */
  71. #define CS_SBUFF  2     /* attivazione o meno single buffering */
  72. #define CS_GCOLOR 3     /* nuovo colore sfondo box di visualizzazione */
  73. #define CS_VDIST  4     /* nuovo valore distanza da piano di proiezione */
  74. #define CS_NPX0   5     /* nuova posizione X per box di visualizzazione */
  75. #define CS_NPY0   6     /* nuova posizione Y per box di visualizzazione */
  76. #define CS_ZOOM   7     /* nuovo valore per zoom scena */
  77.  
  78. /** STRUTTURE DATI DI USO ESTERNO ED INTERNO **/
  79. /* vertice, usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  80. struct vertex
  81. {
  82. long int x;
  83. long int y;
  84. long int z;
  85. };
  86.  
  87. /* struttura per definizione colore */
  88. struct rgbtype
  89. {
  90. short int r;
  91. short int g;
  92. short int b;
  93. };
  94.  
  95. /* struttura tag3d per definire un array di valori estendibile */
  96. /* analogo alla struttura TagItem dell' Amiga O.S.             */
  97. struct tag3d
  98. {
  99. short unsigned int tipo;        /* flag che identifica valore
  100.                                                 (se=0 fine array) */
  101. long int val;                   /* valore effettivo */
  102. };
  103.  
  104. /* !!! STRUTTURE E DEFINIZIONI GLOBALI DI USO ESCLUSIVAMENTE INTERNO !!! */
  105.  
  106. /** COSTANTI DI USO SOLO INTERNO **/
  107. #define MAXPOINT  4     /* massimo numero di punti per poligono */
  108. #define MAXOBJECT 100   /* massimo numero oggetti per mondo 3D (max. 65535)*/
  109. #define MAXPLFRAM 10000 /* massimo numero poligoni in una frame (16*12) */
  110. #define MAXVERT   1000  /* massimo numero vertici in un poligono */
  111.  
  112. /************ macro solo locali *******/
  113. #define SMARG  16
  114. #define SMARGM 8
  115. #define LTMP 1000
  116. #define ATMP 1000
  117.  
  118. /* matrice di trasformazione (4x4) */
  119. /* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  120. struct matrix4x4
  121. {
  122. long int r0c0;
  123. long int r0c1;
  124. long int r0c2;
  125. long int r0c3;
  126. long int r1c0;
  127. long int r1c1;
  128. long int r1c2;
  129. long int r1c3;
  130. long int r2c0;
  131. long int r2c1;
  132. long int r2c2;
  133. long int r2c3;
  134. long int r3c0;
  135. long int r3c1;
  136. long int r3c2;
  137. long int r3c3;
  138. };
  139.  
  140. /* matrice di trasformazione (1x4) */
  141. /* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  142. struct matrix1x4
  143. {
  144. long int r0c0;
  145. long int r0c1;
  146. long int r0c2;
  147. long int r0c3;
  148. };
  149.  
  150. /* vettore */
  151. /* usa formato float a virgola fissa ,(val*@{"FIXV" LINK File 25}) */
  152. struct vector
  153. {
  154. long int x;
  155. long int y;
  156. long int z;
  157. long int w;
  158. };
  159.  
  160. /* pixel */
  161. /* usa formato intero a 2 bytes */
  162. struct pixel
  163. {
  164. short int x;
  165. short int y;
  166. };
  167.  
  168. /* struttura per definire una linea */
  169. /* usa due riferimenti a strutture vertice */
  170. struct line
  171. {
  172. @{"struct vertex" LINK File 45} *a;               /* puntatore a st. vertex di partenza */
  173. @{"struct vertex" LINK File 45} *b;               /* puntatore a st. vertex d'arrivo */
  174. };
  175.  
  176. /* struttura per definire direzione in spazio 3d */
  177. struct dir3d
  178. {
  179. long int angx;
  180. long int angy;
  181. long int angz;
  182. };
  183.  
  184. /* struttura per definizione di un poligono */
  185. struct polygon
  186. {
  187. char numpoints;
  188. short int color;
  189. short int shade;
  190. char twosided;
  191. char visible;
  192. char clipped;
  193. char active;
  194. long int vertexlist0;   /* puntatore a #1 indice vertici */
  195. long int vertexlist1;   /* puntatore a #2 indice vertici */
  196. long int vertexlist2;   /* puntatore a #3 indice vertici */
  197. long int vertexlist3;   /* puntatore a #4 indice vertici */
  198. };
  199.  
  200. /* struttura di descrizione di un oggetto */
  201. struct objectnode
  202. {
  203. long int id;            /* identificativo univoco per oggetto */
  204. long int dummy;         /* pad per poter usare name con StringF */
  205. char name[22];
  206. long int numverts;
  207. @{"struct vertex" LINK File 45} *vorig;   /* puntatore a elenco vertici loc. orig. */
  208. @{"struct vertex" LINK File 45} *vlocal;  /* puntatore a elenco vertici locali */
  209. @{"struct vertex" LINK File 45} *vcamera; /* puntatore a elenco vertici camera */
  210. long int numpolys;
  211. @{"struct polygon" LINK File 150} *polys;  /* puntatore a elenco poligoni */
  212. char shade;             /* metodo di visualiz. (WIRE,@{"SOLID" LINK File 20},@{"FLAT" LINK File 21}) */
  213. char state;             /* segnala se oggetto da visualizzare */
  214. char clipped;           /* segnala se oggetto clippato interamente*/
  215. char trasf;             /* flag per segnalare eventuale trasf. avv.*/
  216. long int worldposx;     /* coord. x punto d'inserzione oggetto */
  217. long int worldposy;     /* coord. y  "        "          "     */
  218. long int worldposz;     /* coord. z  "        "          "     */
  219. long int xmax;          /* vertici bounding box oggetto */
  220. long int ymax;          /*              "               */
  221. long int zmax;          /*              "               */
  222. long int xmin;          /*              "               */
  223. long int ymin;          /*              "               */
  224. long int zmin;          /*              "               */
  225. };
  226.  
  227. /* struttura per definizione di un poligono da visualizzare */
  228. struct polytemp
  229. {
  230. short int       x1;
  231. short int       y1;
  232. short int       x2;
  233. short int       y2;
  234. short int       x3;
  235. short int       y3;
  236. short int       x4;
  237. short int       y4;
  238. short int       x5;
  239. short int       y5;
  240. short int numpoints;
  241. short int     shade;
  242. short int       obj;
  243. long  int      npol;
  244. long  int    svalue;
  245. char          vmode;
  246. };
  247.  
  248. /**
  249.         struttura di descrizione generale ambiente, il puntatore ad essa
  250.         va dato come primo parametro al richiamo di ogni funzione
  251.         dall'esterno
  252. **/
  253. struct ambient3d
  254. {
  255. @{"struct grafica" LINK File 285} *graf;           /* valore ritornato da PE_ini_g */
  256. struct Window *win;             /* punt. a finestra usata */
  257. long int half_screen_width;
  258. long int half_screen_height;
  259. long int viewing_distance;
  260. short int gl_triangle_color;
  261. short int minx;
  262. short int miny;
  263. short int maxx;
  264. short int maxy;
  265. short int maxintensity;
  266. long int near_z;
  267. long int far_z;
  268. long int zoom;                  /* num. reale a virgola fissa (val*@{"FIXV" LINK File 25}) */
  269. long int aspect_ratio;          /* num. reale a virgola fissa (val*@{"FIXV" LINK File 25}) */
  270. long int ambient_light;         /* num. reale a virgola fissa (val*@{"FIXV" LINK File 25}) */
  271. long int inv_aspect_ratio;      /* num. reale a virgola fissa (val*@{"FIXV" LINK File 25}) */
  272. long int bord_col;              /* colore bordo poligoni (se <0 no bordo)*/
  273. long int gcolor;                /* colore sfondo scena */
  274. char projection_type;           /* tipo di proiezione (0=pros. 1=paral.) */
  275. char view_mode;                 /* modo vis. (1=flat 0=wire 2=solid) */
  276. char clip_mode;
  277. char agg_all;                   /* flag per forzare aggiornamento scena */
  278. long int dummy;
  279. @{"struct vector" LINK File 117} light_source;     /* puntatore a struttura vector */
  280. long int dummy1;
  281. @{"struct vector" LINK File 117} view_point;       /* puntatore a struttura vector */
  282. @{"struct dir3d" LINK File 142} view_angle;        /* puntatore a struttura dir3d */
  283. @{"struct matrix4x4" LINK File 85} global_view;   /* puntatore a struttura matrix4x4 */
  284. char *temp;                     /* puntatore ad area per uso temporaneo */
  285. long int *iobjects;             /* punt. ad array con indici su objects */
  286. @{"struct objectnode" LINK File 166} *objects;     /* punt. ad array di strutture objectnode */
  287. long int *iwpolys;              /* punt. ad array puntatori su worldpolys */
  288. @{"struct polytemp" LINK File 193} *worldpolys;    /* punt. ad array di strutture polytemp */
  289. long int *sintable;             /* punt. ad array di reali a virg. fissa */
  290. long int *costable;             /* punt. ad array di reali a virg. fissa */
  291. long int total_polys;           /* n# totale poligoni da tracciare */
  292. short int total_objects;        /* n# totale oggetti presenti */
  293. long int attuale;               /* oggetto attualmente selezionato */
  294. long int numero;                /* numero inc. alla creazione di un oggetto*/
  295. long int iterazioni;            /* n# iterazioni per sorting */
  296. };
  297.  
  298. /* !!! STRUTTURE E DEFINIZIONI GLOBALI DI USO ESCLUSIVAMENTE INTERNO !!! */
  299.  
  300. #define MAXVER(vert) (vert*5+30)
  301.  
  302. /**** dichiarazioni per poter usare sizeof con queste strutture  ****/
  303. /**** probabilmente utile solo se si usa VBCC v0.5 ****/
  304.  
  305. typedef @{"struct grafica" LINK File 285} Sgrafica;
  306. typedef struct AreaInfo SAreaInfo;
  307. typedef struct TmpRas STmpRas;
  308. typedef struct RastPort SRastPort;
  309. typedef @{"struct objectnode" LINK File 166} Sobjectnode;
  310. typedef @{"struct vertex" LINK File 45} Svertex;
  311. typedef @{"struct polygon" LINK File 150} Spolygon;
  312. typedef @{"struct vector" LINK File 117} Svector;
  313. typedef @{"struct polytemp" LINK File 193} Spolytemp;
  314. typedef @{"struct dir3d" LINK File 142} Sdir3d;
  315. typedef @{"struct matrix4x4" LINK File 85} Smatrix4x4;
  316. typedef @{"struct ambient3d" LINK File 218} Sambient3d;
  317.  
  318. /********************************************************************/
  319.  
  320. struct grafica
  321. {
  322.  struct AreaInfo *o_ai; /* valore originale puntatore ad areainfo */
  323.  struct TmpRas *o_tr;   /* valore originale puntatore ad tmprast */
  324.  struct AreaInfo n_ai;  /* nuova areainfo */
  325.  struct TmpRas n_tr;    /* nuova tmpras */
  326.  char *pras;            /* puntatore a area di memoria grafica */
  327.  char *b_af;            /* puntatore a buffer vettori per areafill */
  328.  long int lb_af;        /* dimensioni area precedente */
  329.  struct ViewPort *vpor; /* puntatore a viewport dello schermo della fin.*/
  330.  struct RastPort *rast; /* puntatore a rastport usato dalle routin */
  331.  struct Window *wind;   /* puntatore a finestra su cui agire */
  332.  long int larg;         /* larghezza box in cui lavorera' areafill */
  333.  long int alte;         /* altezza box in cui lavorera' areafill */
  334.  short int clipx;       /* origine x clip box */
  335.  short int clipy;       /* origine y clip box */
  336.  short int clipdx;      /* larghezza clip box */
  337.  short int clipdy;      /* altezza clip box */
  338. /** estensioni per double buffering **/
  339.  char   fdouble;        /* flag per attivare double buffer (0=off 1=on)*/
  340.         /** campi usati da libreria ottimizzata **/
  341.  char *dbuf;            /* puntatore ad display buffer chunky*/
  342.  long int ldbuf;        /* lunghezza in bytes di area dbuf */
  343.  struct RastPort tmp_rp;/* rastport temporanea */
  344.         /******************************************/
  345.  struct RastPort *rast1;/* puntatore a rastport della finestra*/
  346.  struct RastPort *rast2;/* puntatore a rastport nascosto */
  347.         /** campi usati da libreria normale **/
  348.  struct RasInfo    *NB_rinfo;
  349.  struct BitMap     *NB_bmap;
  350.  struct Layer_Info *NB_layerinfo;
  351.  struct Layer      *NB_layer;
  352.         /*************************************/
  353. };
  354.  
  355.  
  356. #endif /* GRAPHICS3D_GRAPHICS3D_H */
  357. @ENDNODE
  358.